package com.qingcheng.controller.order;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.pojo.order.Order;
import com.qingcheng.pojo.order.OrderConfig;
import com.qingcheng.pojo.order.OrderLog;
import com.qingcheng.service.order.CategoryReportService;
import com.qingcheng.service.order.OrderService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Component
public class OrderTask {

    @Reference
    private OrderService orderService;

    @Scheduled(cron = "0 0/2 * * * ?")
    public void orderTimeOutLogic() {
        System.out.println("每两分钟间隔执行一次任务" + new Date());
        orderService.orderTimeOutLogic();
    }

    @Reference
    private CategoryReportService categoryReportService;

    
    @Scheduled(cron = "0 0 1 * * ?")
    public void createCategoryReportDate() {
        System.out.println("生成类目统计数据");
        categoryReportService.createData();

        System.out.println("生成交易统计数据");
        orderService.createData();
    }


}
